package com.blb.ssh.service.impl;

import com.blb.ssh.dao.UserDao;
import com.blb.ssh.entity.User;
import com.blb.ssh.exception.BusinessException;
import com.blb.ssh.service.UserService;

public class UserServiceImpl implements UserService {
	
	private UserDao userDao; 

	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}

	@Override
	public void login(String username, String password) throws BusinessException {
		System.out.println("start----");
		User user = userDao.getUserByUserName(username);
		if (user==null) {
			throw new BusinessException("用户名不存在");
		}
		if (!user.getPassword().equals(password)) {
			throw new BusinessException("密码错误");
		}
		System.out.println("end----");
	}

}
